<template>
	<view>
		<js-error mode="bottom" ref="jsError"></js-error>
		<u-sticky class="u-sticky">
			<!-- bg-blue  -->
			<view class="padding-sm flex light " style="background-color: #eee;">
						<view style="width: 85%">
							<u-search placeholder="拍照/输入批次" :focus="focus1" v-model="keyword" bg-color="#fff" :show-action="false"  searchIconSize="26"  
								:inputStyle="inputStyle" @search="confirm('pc')"  @clear="clearCbatch"></u-search></view>
						<text class="cuIcon-more text-xxl"  style="width: 15%;text-align: right;" @click="show=true"></text>
			</view>
		</u-sticky>
		<u-popup v-model="show" mode="right" length="90%">



			<!-- class="form"  -->
			<u-form class="form" style="padding: 0 10px;" :model="query" ref="uForm" label-position="left">
				<view style="" class="text-border">
					<view class="text text-lg text-green">存货信息</view>
					<u-form-item  label="存货编码:" prop="invCode" label-width="220">
						<view class="flex">	
							<u-search v-model="query.invCode" ref="uSearch" :focus="focus" placeholder="请先聚焦后扫描" :show-action="false" @search="confirm('inv')" bgColor="#fff"></u-search>
							<text class="cuIcon-scan text-xxl margin-right" @click="search('inv')" ></text>
						</view>
					</u-form-item>
					<u-form-item label="存货名称:" prop="invName" label-width="220">
						<u-input placeholder="请输入" v-model="query['basInv.invName']" type="text" maxlength="200"></u-input>
					</u-form-item>
					<u-form-item label="规格型号:" prop="invStd" label-width="220">
						<u-input placeholder="请输入" v-model="query['basInv.invStd']" type="text" maxlength="200"></u-input>
					</u-form-item>
					
				</view>
				<view style="" class="text-border">
					<view class="text text-lg text-green">单据信息</view>
					<u-form-item label="单据号:" prop="djno" label-width="220">
						<u-input placeholder="请输入" v-model="query.djno" type="text" maxlength="200"></u-input>
					</u-form-item>
					
					<u-form-item label="部门:" prop="officeName" label-width="220">
						<u-input placeholder="请输入" v-model="query['office.officeName']" type="text" maxlength="200"></u-input>
					</u-form-item>
					<u-form-item label="备注:" prop="remarks" label-width="220">
						<u-input placeholder="请输入" v-model="query.remarks" type="text" maxlength="200"></u-input>
					</u-form-item>
					<u-form-item label="单据日期(起)" prop="time" label-width="220">
						<u-input placeholder="请选择" v-model="query.ddate_gte" type="select" :select-open="startTime"
							@click="startTime = true"></u-input>
					</u-form-item>
					<u-form-item label="单据日期(止)" prop="time" label-width="220">
						<u-input placeholder="请选择" v-model="query.ddate_lte" type="select" :select-open="endTime"
							@click="endTime = true"></u-input>
					</u-form-item>
				</view>
			
				<view style="" class="text-border">
					<view class="text text-lg text-green">批次信息</view>
					<u-form-item label="批次:" prop="cbatch" label-width="220">
						<!-- :disabled="true" -->
						<u-input placeholder="请扫描" v-model="query.cbatch" type="text" maxlength="200" ></u-input>
					</u-form-item>
				</view>
				
				
				<u-picker mode="time" v-model="startTime" @confirm="startConfirm"></u-picker>
				<u-picker mode="time" v-model="endTime" @confirm="endConfirm"></u-picker>
			</u-form>
			<!-- <view class="footer">
	  		<u-button class="btn" type="primary" @click="submit">查询</u-button>
	  	</view> -->
			<view class="cu-bar"></view>
			<view class=" flex cu-bar tabbar bg-white foot cu-modal-footer">
				<!-- round -->
				<button class="cu-btn  lines-red lg " @click="reset">重置</button>
				<button class="cu-btn  bg-confirm lg margin-left " @click="submit">查询</button>
			</view>
		</u-popup>
		<scroll-view scroll-y="true" @scrolltolower="loadMore" :refresher-enabled="true" :scrolltolower-enabled="true"
			:refresher-triggered="triggered" @refresherrefresh="refresherrefresh" @scrolltoupper="refresherrefresh"
			class="scroll-view-class" :style="{ height: computedScrollViewHeight }">
			<view class="scroll-content" ref="scrollContent" style="
          display: flex;
          flex-direction: column;
          justify-content: space-between;
        " :style="{ height: computedScrollViewHeight  }">
				<view v-for="(item,index) in list" class="cu-item shadow " style="position: relative;" :key="item.id">
					<view class="cu-form-group" style="display: flex;justify-content: space-between;">
						<view
							style=" display: inline-block;padding: 5px;background: #3E97B0;color: #fff;min-width: 40px;text-align: center;font-style: italic;font-weight: bold">
							{{ index + 1 }}
						</view>
						<dictLabel :value="item.djStatus" dict-type="wms_rd10_status" style="padding-left: 0;"> </dictLabel>
						<view style="font-size: 40rpx;" class="text-bold text-red">
							{{item.djno || ''}} 
						</view>
					</view>

					<view class="cu-form-group ">
						<view class="title">单据日期：</view>
						<view style="flex: 1;"> {{ item.ddate|| ""  }}{{ item.createByName ? '('+ item.createByName +')': '' }} </view>
					</view>
					<view class="cu-form-group">
						<view class="title">批次：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.cbatch || ""  }}  
						</view>
					</view>
					<view class="cu-form-group ">
						<view class="title">存货编码：</view>
						<view style="flex: 1;"> {{ item.invCode|| ""  }}</view>
					</view>
					<view class="cu-form-group ">
						<view class="title">名称规格：</view>
						<view style="flex: 1;"> {{ item.basInv.invName|| ""  }}（{{ item.basInv.invStd || "" }} ）</view>
					</view>
					<view class="cu-form-group">
						<view class="title">部门：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.office.officeName || ""  }} 
							
						</view>
					</view>
					<view class="cu-form-group">
						<view class="title">仓库：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.basWare.cwhname || ""  }} 
							
						</view>
					</view>

					<view class="cu-form-group justify-start">
						<view class="title">检验员/品级：</view>
						<view class="flex justify-between align-center"> 
						<dictLabel :value="item.checkBy" dict-type="mf_check_person" style="padding-left: 0;"></dictLabel>
						/<dictLabel :value="item.cgrade" dict-type="mf_grade" ></dictLabel>
						</view>
					</view>
					<view class="cu-form-group justify-start">
						<view class="title">班次/班组：</view>
						<view class="flex justify-between align-center"> 
						<dictLabel :value="item.teamClass" dict-type="mf_team_class" style="padding-left: 0;"></dictLabel>
						/<dictLabel :value="item.cteam" dict-type="mf_team" ></dictLabel>
						</view>
						
					</view>					
					<view class="cu-form-group" v-if="item.basInv.bfixExch!=0">
						<view class="title">剩余入库/件数：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.syNum || '0'  }} / {{ item.inum || '0'  }} 
							
						</view>
					</view>
					<view class="cu-form-group">
						<view class="title">剩余入库/数量：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.syQty || '0'  }} / {{ item.iqty || '0'  }}  {{ item.basInv && item.basInv.unitName ? '('+ item.basInv.unitName +')' : ''  }} 
							
						</view>
					</view>	
					<view class="cu-form-group">
						<view class="title">备注：</view>
						<view style="flex: 1;" class="flex justify-between align-center"> 
							{{ item.remarks || ''  }}
							
						</view>
					</view>	
					<!-- justify-end -->
					<view class="cu-form-group" :class="viewFlagBtn &&(item.djStatus == '4' ||item.djStatus == '9') ? 'justify-between' : 'justify-between'">
						<button  class="cu-btn shadow-blur" @tap="closeDetail(item)" v-if="closeFlagBtn">
							<u-icon name="close-circle" style="margin-right: 5px;"></u-icon>
							关闭
						</button>
						<!-- v-if="closeFlagBtn" -->
						<button  class="cu-btn shadow-blur" @tap="rkDetail(item)" v-if="viewFlagBtn &&(item.djStatus == '4' ||item.djStatus == '9')">
							<u-icon name="shopping-cart" style="margin-right: 5px;"></u-icon>
							入库明细
						</button>
						
						<button  class="cu-btn bg-green shadow-blur" @tap="rk(item)" v-if="flagBtn">
							<u-icon name="shopping-cart" style="margin-right: 5px;"></u-icon>
							入库
						</button>
					</view>
				</view>

				<view v-if="list.length" class="loadmore" style="justify-self: flex-end">
					<u-loadmore :status="loadStatus"></u-loadmore>
				</view>
				<u-empty v-if="!list.length" style="height: 80vh;"></u-empty>
			</view>
		</scroll-view>
		<view class="btn-group cu-bar foot" v-if="flag">
			<button class="cu-btn bg-green shadow-blur" @tap="chcx()">
				<u-icon name="search" style="margin-right: 5px;"></u-icon>
				材料查询
			</button>
		</view>
		<movable-area class="movable-area1">
			<movable-view class="movable-view" :x="x" :y="y" direction="all">
				<view @click="search('pc')" class="custom-style" style="width: 90px; height: 70px; color: #fff; border-radius: 10rpx;">
					<view style="font-size: 16px;display: flex; flex-direction: column;text-align: center;">
						<text class="cuIcon-camera text-xxl text-blue"></text>
						<view class="text-blue text-bold">批次识别</view>
					</view>
				</view>
				<!-- <button size="mini" >
					
				</button> -->
			</movable-view>
		</movable-area>
	</view>
</template>
<script>
	import dictLabel from "./dictLabel.vue";
	import { hasPermission } from '@/common/fire.js';
	import util from '@/common/fire.js'
	export default {
		components: {
		  dictLabel,
		},
		data() {
			return {
				type: 'text',
				startTime: false, //控制日期显示
				endTime: false, //控制日期显示
				show: false,
				inputStyle: {
					fontSize: '34rpx'
				},
				filterIcon: "/static/image/filter.png",
				keyword: "",
				background: {
					backgroundColor: '#3E97B0',
				},
				list: [],
				itemContent: {},
				query: {
					pageNo: 1,
					pageSize: 5,
					// orderBy: "a.create_date desc",
				},
				loadStatus: "loadmore",
				triggered: false,
				flagBtn: hasPermission('wms.wh:rd10:wmsRds10:edit'),
				viewFlagBtn:  hasPermission('wms.wh:rd10:wmsRds10:view'),
				closeFlagBtn:  hasPermission('wms.wh:rd10:wmsRd10:close'),
				flag: false,
				scrollViewHeight: 0,
				headerHeight: 0,
				projStatus: this.$store.state.auth.projStatus,
				barCode: "",
				focus: false ,
				focus1: false,
				x: 650, //x坐标
				y: 650, //y坐标
			};
		},
		onShow() {
			this.query.pageNo = 1;
			this.loadData();
		},
		onLoad(e) {

		},
		computed: {
			formattedDate() {
			// 在这里处理日期格式，如果需要的话
			return this.items.extend.cdefine36 || '';
			},
		},
		mounted() {
			// this.$refs.xmInfo.$on('child-mounted-done', () => {
			//   this.calculateScrollViewHeight();
			// });
			this.calculateScrollViewHeight();
		},
		computed: {
			computedScrollViewHeight() {
				return this.scrollViewHeight === 'auto' ? 'auto' : `${this.scrollViewHeight}px`;
			},
		},
		methods: {
			confirmCbatch(){
				this.query.cbatch = this.keyword;
				this.loadData()
			},
			clearCbatch(){
				this.keyword = ''
				this.query.cbatch = ''
				this.loadData()
			},
			makeSound(name){
				console.log("=====testClick=====");
				let src = '/static/'+name+'.mp3';
				//实例化声音  
				const Audio = uni.createInnerAudioContext();
				Audio.autoplay = true;
				Audio.src = src; //音频地址  
				Audio.play(); //执行播放  
				Audio.onError((res) => {
				});
				Audio.onPause(function() {
					console.log('end');
					Audio.destroy();
				});
			},
			confirm(name) {
				if(name === 'pc'){
					this.focus = false
					this.query.cbatch = this.keyword;
					this.commonSearch(this.query.cbatch)
				}else if(name === 'inv'){
					this.focus = false
					console.log(this.barCode, 'barCode')
					this.commonSearch(this.query.invCode)
				}
			},
			search(name) {
				var _that = this;
				_that.focus = false
				if(this.vuex_config.deviceType === this.vuex_config.deviceTypeAPP){
					// uni.scanCode({
					// 	scanType: ["barCode", "qrCode"],
					// 	// onlyFromCamera: true,
					// 	success: async (res) => {
					// 		_that.barCode = res.result;
					// 		await _that.commonSearch(res.result)
					// 	},
					// });
					const wechat = uni.getSystemInfoSync()?.host?.env
					if (wechat === 'WeChat') {
						const wechat = uni.getSystemInfoSync()?.host?.env
						if (wechat === 'WeChat') {
						    uni.scanCode({
						    	scanType: ["barCode", "qrCode"],
						    	// onlyFromCamera: true,
						    	success: async (res) => {
						    		_that.barCode = res.result;
						    		await _that.commonSearch(res.result)
						    	},
						    });
						} else {
							var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
							console.log('mpaasScanModule',mpaasScanModule)
							
							mpaasScanModule.mpaasScan({
								// 扫码识别类型，参数可多选，qrCode、barCode，不设置，默认识别所有
								'scanType':  ['qrCode','barCode'],
								// 是否隐藏相册，默认false不隐藏
								'hideAlbum': false,
								//ios需要设置这个参数，只支持中英文 zh-Hans、en，默认中文                       
								'language' : 'en',
								//相册选择照片识别错误提示(ios)
								'failedMsg': '未识别到二维码，请重试',
								//Android支持全屏需要设置此参数
								'screenType': 'full'              
							},
							async (ret) => {
								console.log('ret',ret)
								if(ret.resp_message == 'success'){
									_that.barCode = ret.resp_result;
									await _that.commonSearch(ret.resp_result)
								}
							})
						}
					} else {
						var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");						
						mpaasScanModule.mpaasScan({
							// 扫码识别类型，参数可多选，qrCode、barCode，不设置，默认识别所有
							'scanType':  ['qrCode','barCode'],
							// 是否隐藏相册，默认false不隐藏
							'hideAlbum': false,
							//ios需要设置这个参数，只支持中英文 zh-Hans、en，默认中文                       
							'language' : 'en',
							//相册选择照片识别错误提示(ios)
							'failedMsg': '未识别到二维码，请重试',
							//Android支持全屏需要设置此参数
							'screenType': 'full'              
						},
						async (ret) => {
							console.log('ret',ret)
							if(ret.resp_message == 'success'){
								_that.barCode = ret.resp_result;
								await _that.commonSearch(ret.resp_result)
							}
						})
					}
				}else if(this.vuex_config.deviceType === this.vuex_config.deviceTypePDA){
					if(name === 'inv'){
						_that.focus = false
						setTimeout(()=>{
							_that.focus = true
						},500)
					}else if(name === 'pc'){
						_that.focus1 = false
						setTimeout(()=>{
							_that.focus1 = true
						},500)
					}
					
					
				}
				
				
			},
			async commonSearch(barCode) {
				this.query.invCode = ''
				let that = this
				//扫存货
				console.log(util.checkBarcode(barCode, this.vuex_config.cbatchPrefix))
				if (util.checkBarcode(barCode, this.vuex_config.cbatchPrefix) 
					|| util.checkBarcode(barCode, this.vuex_config.TuoPanPrefix)) {
					this.$u.api.mf.getBarInfo({
						barCode,
					}).then(res => {
						if(res.result == 'true'){
							if (!res.error) {
								if(res.data.basInv){
									console.log(res,'res')
									this.keyword = res.data.batchInfo.scBatch
									this.query.cbatch = res.data.batchInfo.scBatch
									this.loadData()
									this.$forceUpdate()
									setTimeout(()=>{
										that.makeSound("cg");
									},500)
								}else{
									setTimeout(()=>{
										that.makeSound("sb");
									},500)
									that.$refs.jsError.showError('', '验证失败！', 'error');
								}
								
							} else {
								setTimeout(()=>{
									that.makeSound("sb");
								},500)
								that.$refs.jsError.showError('', res.error, 'error');
							}
						}else{
							setTimeout(()=>{
								that.makeSound("sb");
							},500)
							that.$refs.jsError.showError('', res.message, 'error');
						}
					})
				}else if (util.checkBarcode(barCode, this.vuex_config.InventoryPrefix)) {
					this.$u.api.mf.getBarInfo({
						barCode,
					}).then(res => {
						if(res.result == 'true'){
							if (!res.error) {
								if(res.data.basInv){
									console.log(res,'res')
									this.query.invCode = res.data.basInv.invCode
									this.$forceUpdate()
									setTimeout(()=>{
										that.makeSound("cg");
									},500)
								}else{
									setTimeout(()=>{
										that.makeSound("sb");
									},500)
									that.$refs.jsError.showError('', '验证失败！', 'error');
								}
								
							} else {
								setTimeout(()=>{
									that.makeSound("sb");
								},500)
								that.$refs.jsError.showError('', res.error, 'error');
							}
						}else{
							setTimeout(()=>{
								that.makeSound("sb");
							},500)
							that.$refs.jsError.showError('', res.message, 'error');
						}
					})
				}  else {
					setTimeout(()=>{
						that.makeSound("sb");
					},500)
					this.$refs.jsError.showError('', '请扫描正确的条码！', 'error');
				}
			
				setTimeout(() => {
					this.barCode = '';
				}, 500);
			
			},
			chcx(item) {
				uni.navigateTo({
					url: '/pages/mf/llsq/chList',
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {
							console.log(data)
						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						//res.eventChannel.emit('initfilter', that.queryData)
					}
				})
			},
			rk(item) {
				uni.navigateTo({
					url: '/pages/mf/cprk/edit?id=' + item.id,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {
							console.log(data)
						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						//res.eventChannel.emit('initfilter', that.queryData)
					}
				})
			},
			closeDetail(item){
				let that = this
				uni.showModal({
					title: '提示',
					content: '是否关闭入库通知？',
					confirmColor: '#00007f',
					success: (res) => {
						if (!res.confirm) {
							return false;
						} else {
							this.$u.api.mf.wmsRd10Close({
								selIds: item.id,
								isApp:'1'
							}).then(res => {
								if (res.result == 'true') {
									// that.$u.toast("成功！");
									that.$refs.jsError.showError('', res.message, 'success');
									that.loadData();
								} else {
									that.$refs.jsError.showError('', res.message, 'error');
								}
							})
						}
					}
				})
			},
			rkDetail(item) {
				uni.navigateTo({
					url: '/pages/mf/cprk/listDetail?djno=' + item.djno,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {
							console.log(data)
						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						//res.eventChannel.emit('initfilter', that.queryData)
					}
				})
			},
			carNoconfirm(v) {
				this.query.carNo = v;
				this.$forceUpdate()
			},
			showKeyboard(ref) {
				this.$refs[ref].toShow(this.query.carNo)
			},
			editDetail(model) {
				const that = this
				uni.navigateTo({
					url: '/pages/mf/fjwz/detailForm?id=' + model.id,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {

						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						// res.eventChannel.emit('initfilter', that.filter)
					}
				})
			},
			addDH(item) {
				const that = this
				let id = item.id ? item.id : ''
				uni.navigateTo({
					url: '/pages/mf/fjwz/form?id=' + id,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {

						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						// res.eventChannel.emit('initfilter', that.filter)
					}
				})
			},
			//跳转详情页面上传图片
			toFj(model) {
				const that = this
				uni.navigateTo({
					url: '/pages/mf/fjwz/upload?id=' + model.id,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {

						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						// res.eventChannel.emit('initfilter', that.filter)
					}
				})
			},
			toEdit(model) {
				const that = this;
				uni.showModal({
					title: '修改提示',
					content: '是否准备就绪？',
					confirmColor: '#00007f',
					success: (res) => {
						if (!res.confirm) {
							return false;
						} else {
							this.$u.api.mf.fjinvalid({
								id: model.id
							}).then(res => {
								if (res.result == 'true') {
									that.$u.toast("成功！");
									that.loadData();
								} else {
									that.$refs.jsError.showError('', res.message, 'error');
								}
							})
						}
					}
				})
			},
			toAdd(model) {
				const that = this
				uni.navigateTo({
					url: '/pages/mf/fjwz/detailForm?hid=' + model.id,
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						Filter(data) {

						}
					},
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						// res.eventChannel.emit('initfilter', that.filter)
					}
				})
			},
			delData(id) {
				// this.query.id = id;
				uni.showModal({
					title: '删除提示',
					content: '是否删除此计划？',
					confirmColor: '#F54E40',
					success: (res) => {
						if (!res.confirm) {
							this.isdisabled = true
							return false;
						}
						this.$u.api.mf.fjdelete({
							id
						}).then(res => {
							if (res.result == "true") {
								this.$u.toast("删除成功！");
							} else {
								this.$refs.jsError.showError('', res.message, 'error');
							}
							// this.query.id = ''
							// this.list = [];
							this.query.pageNo = 1;
							this.loadData();
						})
					}
				})
			},
			delDetail(id) {
				// this.query.id = id;
				uni.showModal({
					title: '删除提示',
					content: '是否删除此详情？',
					confirmColor: '#F54E40',
					success: (res) => {
						if (!res.confirm) {
							this.isdisabled = true
							return false;
						}
						this.$u.api.mf.fjdelDetail({
							id
						}).then(res => {
							if (res.result == "true") {
								this.$u.toast("删除成功！");
							} else {
								// this.$u.toast(res.message);
								this.$refs.jsError.showError('', res.message, 'error');
							}
							this.query.pageNo = 1;
							this.loadData();
						})
					}
				})
			},
			// this.$forceUpdate();
			reset() {
				this.list = [];
				this.query = {
					pageNo: 1,
					pageSize: 5,
				};
				this.loadData();
				this.show = false
			},
			submit() {
				this.list = [];
				this.query.pageNo = 1;
				this.loadData();
				this.show = false
			},
			startConfirm(e) {
				this.query.ddate_gte = e.year + '-' + e.month + '-' + e.day;
			},
			endConfirm(e) {
				this.query.ddate_lte = e.year + '-' + e.month + '-' + e.day;
			},
			customBack() {
				// 跳转到工作台页面
				uni.navigateBack({
					delta: 1,
				});
			},
			async calculateScrollViewHeight() {
				try {
					// 等待头部高度计算完成
					// await new Promise((resolve) => {
					//   this.$nextTick(() => {
					//     this.headerHeight = this.$refs.xmInfo.$refs['u-sticky'].height + this.$refs.xmInfo.$refs['u-sticky'].h5NavHeight + this.$refs.navbar.navbarHeight;
					//     resolve();
					//   });
					// });
					this.headerHeight = 52
					// 计算tabBar高度
					if (this.flag) {
						this.tabBarHeight = 60; // 假设tabbar高度为50px，实际应根据实际情况获取
					} else {
						this.tabBarHeight = 0;
					}
					// 获取屏幕高度
					const systemInfo = uni.getSystemInfoSync();
					const screenHeight = systemInfo.windowHeight;
					// 计算scroll-view高度
					this.scrollViewHeight = screenHeight - (this.headerHeight + this.tabBarHeight);
				} catch (error) {
					console.error('Error while calculating ScrollView height:', error);
				}
			},

			loadMore() {
				this.loadStatus = "loading";
				setTimeout(() => {
					this.query.pageNo += 1;
					this.loadData("add");
				}, 100);
			},
			loadData(type) {
				// 循环10次重复赋值
				this.$u.api.mf.listNOverData(this.query).then((res) => {
					if (res.list.length >= 0) {
						// this.xmList = res.list
						if (res.list.length < 20 || res.list.length == 0) {
							this.loadStatus = "nomore";
						}
						var data = res.list;
						if (type == "add") {
							for (var i = 0; i < data.length; i++) {
								this.list.push(data[i]);
							}
						} else {
							this.list = data;
						}
					}
				});
			},
			async refresherrefresh() {
				this.triggered = true;
				this.query.pageNo = 1;
				await this.loadData();
				const scrollTop = 0
				uni.pageScrollTo({
					scrollTop,
					duration: 0,
				});
				setTimeout(() => {
					this.triggered = false;
				}, 500);
			},
		},
		// beforeDestroy() {
		// 	// 清理事件监听器
		// 	try {
		// 		this.$refs.xmInfo.$off('child-mounted-done');
		// 	} catch (e) {
		// 		console.log('Error while unbinding event:', e);
		// 	}
		// }
	};
</script>
<style lang="scss" scoped>
	$all_width: 96rpx;
	$all_height: 96rpx;
	.movable-area1 {
		z-index: 888;
		height: 97vh;
		width: 650rpx;
		position: fixed;
		right: $all_width;
		top: -($all_height + 100rpx);
		pointer-events: none; //此处要加，鼠标事件可以渗透
		.movable-view {
			width: $all_width;
			height: $all_height;
			pointer-events: auto; //恢复鼠标事件
			image {
				width: $all_width;
				height: $all_height;
			}
		}
	}
	.text-border{
		border:2px solid  rgb(170, 170, 170); 
		border-radius: 5px;
		position: relative;
		padding-top: 20rpx;
		margin-top: 40rpx;
		padding-left: 20rpx;
		.text{
			position: absolute;
			background-color: #fff;
			padding: 10rpx 10rpx;
			top: -25rpx;
			right: 30rpx;
		}
	}
	.text-xxl{
		font-size:60rpx;
	}
	.cu-bar {
		min-height: 60px;
	}

	.cu-btn {
		font-size: 16px;
		height: 40px;
	}

	.foot {
		background: #fff;
	}

	.cu-item {
		flex-wrap: wrap;
		padding: 8px 15px !important;
	}

	.title {
		width: 280rpx;
	}

	.cu-modal-slot {
		margin: 42rpx 32rpx 20rpx 32rpx;
		height: 100vh;
		position: relative;
	}

	.cu-modal-header {
		font-size: 38rpx;
		color: #3d3d3d;
		line-height: 40rpx;
		text-align: left;
		font-weight: 500;
	}

	.button {
		font-size: 32rpx;
		color: #666666;
		line-height: 40rpx;
		padding: 12rpx 40rpx;
		margin-bottom: 20rpx;
		background: #e2e2e2;
		border-radius: 180rpx;
	}

	.button:hover {
		background: #3e97b0;
		color: #ffffff;
	}

	.cu-modal-search-title {
		margin: 32rpx 0rpx 20rpx 0rpx;
		text-align: left;
		font-size: 32rpx;
		color: #999999;
		line-height: 40rpx;
	}

	.cu-dialog {
		background: #ffffff;
	}

	.cu-modal-footer {
		padding: 32rpx 32rpx;
		width: 100%;

		.cu-btn {
			width: 50%;
		}
	}

	.bg-confirm {
		background: #3e97b0;
		color: #ffffff;
	}
</style>